
#ifndef _DISPATCHER_H_
#define _DISPATCHER_H_

#include <string>

//forward declaration
class Content;
class Request;

class Dispatcher {
public:
	Dispatcher(Request *req);
	~Dispatcher();
	void sendResponse();

private:
	Content *content;
	Request *request;
	std::string mime_type;
	int state;
	char *fname;

	typedef enum {
		PLAIN,
		HTML,
		PHP,
		CGI,
		OTHER
	} FileType;

	FileType file_type;

	std::string getExtension(std::string path);
	FileType isHtmlOrPhp(std::string path);
	bool isExecutable(std::string path);
	bool isDirectory(std::string path);
};

#endif
